Sums of Squares

Introduction

What Does It Mean to Be a Sum of Squares?

Geometric Intuition: Distances and the Plane

Exploring Small Examples

Try listing numbers and checking whether they are sums of two squares:

Patterns begin to appear, but they’re subtle.

Patterns Begin to Emerge

Observations from small numbers:

This multiplication property is a major clue.

Prime Numbers and Sums of Two Squares

Prime numbers behave in a very structured way:

The key pattern:

Fermat’s Two‑Square Theorem

Fermat’s theorem states:

Key ideas (without proof):

Composite Numbers: Building Up from Primes

Once we know how primes behave, we can understand all numbers.

A composite number $n$ is a sum of two squares if and only if:

Example:

Why Some Numbers Fail to Be Sums of Two Squares

Numbers fail for a simple reason:

Examples:

Four Squares: A Surprising Universal Property

Unlike the two‑square case, the four‑square case is dramatically simpler:

Examples:

This universality is one of the most beautiful facts in number theory.

Lagrange’s Four‑Square Theorem

Lagrange proved in 1770:

Key ideas (informal):

Visualizing Sums of Four Squares

Ways to picture four squares:

This geometric viewpoint explains why four squares always suffice.

Connections to Modular Arithmetic

Modular arithmetic helps explain patterns:

Historical Notes and Mathematical Personalities

These results were stepping stones toward modern number theory.

Common Misconceptions and Pitfalls

Exercises

Try these to reinforce the ideas:

  1. Determine whether $21$ can be written as a sum of two squares. Explain why or why not.

    Solution

    Problem: Determine whether $21$ can be written as a sum of two squares.

    • Factorization: $$21 = 3 \cdot 7.$$
    • Both $3$ and $7$ are primes of the form $4k+3$, each with exponent $1$ (odd).
    • Rule: If any prime $\equiv 3 \pmod{4}$ appears with an odd exponent, the number is not a sum of two squares.

    Answer: $21$ cannot be written as a sum of two squares.

  2. Find all representations of $25$ as a sum of two squares.

    Solution

    Problem: Find all representations of $25$ as a sum of two squares.

    We look for integer solutions to $$a^2 + b^2 = 25.$$ Check small squares:

    • $0^2 + 5^2 = 25$
    • $3^2 + 4^2 = 9 + 16 = 25$

    Including sign changes and order:

    • $(a,b) = (\pm 5, 0), (0, \pm 5)$
    • $(a,b) = (\pm 3, \pm 4), (\pm 4, \pm 3)$

    Answer: Up to order and sign, the representations are $$25 = 5^2 + 0^2 = 3^2 + 4^2.$$

  3. Show that $45$ is a sum of two squares by finding explicit $a$ and $b$.

    Solution

    Problem: Show that $45$ is a sum of two squares by finding explicit $a$ and $b$.

    • Factorization: $$45 = 3^2 \cdot 5.$$
    • The prime $3 \equiv 3 \pmod{4}$ appears with exponent $2$ (even), so $45$ can be a sum of two squares.

    Try small squares:

    • $6^2 = 36$, and $45 - 36 = 9 = 3^2$
      So $$45 = 6^2 + 3^2.$$

    Answer: One representation is $$45 = 6^2 + 3^2.$$

  4. Factor $117$ and decide whether it is a sum of two squares.

    Solution

    Problem: Factor $117$ and decide whether it is a sum of two squares.

    • Factorization: $$117 = 9 \cdot 13 = 3^2 \cdot 13.$$
    • Here, $3 \equiv 3 \pmod{4}$ appears with exponent $2$ (even).
    • $13$ is a prime with $13 \equiv 1 \pmod{4}$, which is allowed.
    • Therefore, $117$ can be written as a sum of two squares.

    We can even find one representation:

    • $117 = 9 \cdot 13$
      and $13 = 2^2 + 3^2$, $9 = 3^2 + 0^2$.
    • Using the product formula: $$(3^2 + 0^2)(2^2 + 3^2) = (3\cdot 2 - 0\cdot 3)^2 + (3\cdot 3 + 0\cdot 2)^2 = 6^2 + 9^2 = 36 + 81 = 117.$$

    Answer: Yes, $117$ is a sum of two squares: $$117 = 6^2 + 9^2.$$

  5. Write $23$ as a sum of four squares.

    Solution

    Problem: Write $23$ as a sum of four squares.

    Try to decompose $23$:

    • $4^2 = 16$, remainder $7$.
    • $7$ can be written as $4 + 1 + 1 + 1 = 2^2 + 1^2 + 1^2 + 1^2$.

    So: $$23 = 16 + 4 + 1 + 1 = 4^2 + 2^2 + 1^2 + 1^2.$$ Answer: $$23 = 4^2 + 2^2 + 1^2 + 1^2.$$

  6. Prove that no number of the form $4k+3$ can be written as $a^2 + b^2$ when $k$ is small (try $k=0,1,2$).

    Solution

    Problem: Prove that no number of the form $4k+3$ can be written as $a^2 + b^2$ when $k$ is small (try $k=0,1,2$).

    We check $n = 4k+3$ for $k = 0,1,2$:

    • For $k=0$: $n = 3$
      • Squares modulo $4$ are $0$ or $1$.
      • Possible sums: $0+0=0$, $0+1=1$, $1+1=2$ (mod $4$).
      • None give $3$ (mod $4$), so $3$ is not a sum of two squares.
    • For $k=1$: $n = 7$
      • Same reasoning: any $a^2 + b^2$ is $0,1,$ or $2$ modulo $4$, never $3$.
      • So $7$ is not a sum of two squares.
    • For $k=2$: $n = 11$
      • Again, $a^2 + b^2$ cannot be $3$ modulo $4$, so $11$ is not a sum of two squares.

    Answer: For $3, 7, 11$ (all $4k+3$), no representation as $a^2 + b^2$ exists, consistent with the general rule.

  7. Find a number that is a sum of four squares but not a sum of two squares.

    Solution

    Problem: Find a number that is a sum of four squares but not a sum of two squares.

    We know:

    • Every number is a sum of four squares.
    • Numbers with a prime $\equiv 3 \pmod{4}$ to an odd power are not sums of two squares.

    Take $7$:

    • $7$ is not a sum of two squares (from Exercise 6).
    • But $$7 = 4 + 1 + 1 + 1 = 2^2 + 1^2 + 1^2 + 1^2.$$

    Answer: $7$ is one example: $$7 = 2^2 + 1^2 + 1^2 + 1^2,$$ but it is not a sum of two squares.

  8. Explore: How many ways can $50$ be written as a sum of two squares?

    Solution

    Problem: How many ways can $50$ be written as a sum of two squares?

    We solve $$a^2 + b^2 = 50.$$ Check small squares:

    • $1^2 + 7^2 = 1 + 49 = 50$
    • $5^2 + 5^2 = 25 + 25 = 50$

    So, up to order and sign, we have:

    • $50 = 1^2 + 7^2$
    • $50 = 5^2 + 5^2$

    Including signs and swapping $a$ and $b$:

    • $(\pm 1, \pm 7)$, $(\pm 7, \pm 1)$
    • $(\pm 5, \pm 5)$

    If we count distinct unordered pairs $\{a,b\}$ with $a,b \ge 0$, there are two:

    • $\{1,7\}$ and $\{5,5\}$.

    Answer: There are two essentially different representations: $$50 = 1^2 + 7^2 = 5^2 + 5^2.$$